﻿<%@ Control Language="C#" Inherits="Yuanlin.Business.BusinessInfoAddControl, Yuanlin.Business" AutoEventWireup="true" %>
<script type="text/javascript">
<!--
function checkvalue(){
    var createDate = document.getElementById('<%= createDateValuedTextBox.ClientID %>');
    var title = document.getElementById('<%= titleValuedTextBox.ClientID %>');
    var num = document.getElementById('<%= numValuedTextBox.ClientID %>');
    var visitGreenNum = document.getElementById('<%= visitGreenNumValuedTextBox.ClientID %>');
    var visitGreenNumConfirm = document.getElementById('<%= visitGreenNumConfirmValuedTextBox.ClientID %>');
    
    if(createDate.value.Trim().length>0 && !isDate(createDate.value))
    {
        alert('交易时间不正确！');
        createDate.focus();
        return false;
    }
    if(title.value.Trim().length==0)
    {
        alert('请输入常用名！');
        title.focus();
        return false;
    }
    else if(!isChinese(title.value.Trim()) || len(title.value.Trim())>5)
    {
        alert('常用名请输入汉字，并且最多只能输入5个汉字！');
        title.focus();
        return false;
    }
    if(num.value.Trim().length==0)
    {
        alert('请输入数量！');
        num.focus();
        return false;
    }
    else if(!isInteger(num.value.Trim()))
    {
        alert('数量应为整数型！');
        num.focus();
        return false;
    }
    else if(len(num.value.Trim())>7)
    {
        alert('数量最多7位！');
        num.focus();
        return false;
    }
    if(visitGreenNum.value.Trim().length==0)
    {
        alert('请输入交易对方号！');
        visitGreenNum.focus();
        return false;
    }
    if (!isDigit(visitGreenNum.value.Trim())) {
        alert("绿商号必须是11位或12位数字!");
        visitGreenNum.focus();
        return false;
    } else if (!(visitGreenNum.value.Trim().length == 11 || visitGreenNum.value.Trim().length == 12)) {
        alert("绿商号必须是11位或12位数字!");
        visitGreenNum.focus();
        return false;
    }
    if(visitGreenNumConfirm.value.Trim().length==0)
    {
        alert('请输入确认绿商号！');
        visitGreenNumConfirm.focus();
        return false;
    }
    if (!isDigit(visitGreenNumConfirm.value.Trim())) {
        alert("绿商号必须是11位或12位数字!");
        visitGreenNumConfirm.focus();
        return false;
    } else if (!(visitGreenNumConfirm.value.Trim().length == 11 || visitGreenNumConfirm.value.Trim().length == 12)) {
        alert("绿商号必须是11位或12位数字!");
        visitGreenNumConfirm.focus();
        return false;
    }
    if(visitGreenNum.value.Trim() != visitGreenNumConfirm.value.Trim())
    {
        alert('对方绿商号和确认绿商号不同！');
        visitGreenNumConfirm.focus();
        return false;
    }
    
    return true;
}
//-->
</script>
<div class="AdminArea" style="height:300px">
    <fieldset>
        <legend><nwap:ResourceLiteral runat="server" ResourceName="System_Applications_Yuanlin_AddBusinessInfo" ResourceFile="ControlPanelResources.xml"></nwap:ResourceLiteral></legend>
		
		<div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ControlToLabel="createDateValuedTextBox" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_BusinessInfo_CreateDate" />
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth Cursor" id="createDateValuedTextBox" onclick="MyCalendar.SetDate(this)"/>
        </div>
         <div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ControlToLabel="categoryDropDownList" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_CompanyProduct_ParentCategory" />
            <nwap:ValuedDropDownList Runat="server" Width="200px" id="categoryDropDownList" />
        </div>
        <div class="FormRow">
             <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ControlToLabel="titleValuedTextBox" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_BusinessInfo_Title" />
            </div>
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="titleValuedTextBox" />
        </div>
        <div class="FormRow">
             <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ControlToLabel="numValuedTextBox" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_BusinessInfo_Num" />
            </div>
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="numValuedTextBox" />
        </div>
        <div class="FormRow">
             <div class="LargerFieldNameRequireCharacter">
                <nwap:ResourceLabel runat="Server" CssClass="RedColor" ResourceFile="ControlPanelResources.xml" ResourceName="RequireCharacter" />
                <nwap:ResourceLabel runat="Server" ControlToLabel="visitGreenNumValuedTextBox" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_BusinessInfo_VisitGreenNum" />
            </div>
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="visitGreenNumValuedTextBox" />
        </div>
        <div class="FormRow">
            <nwap:ResourceLabel CssClass="FieldName" runat="Server" ControlToLabel="visitGreenNumConfirmValuedTextBox" ResourceFile="ControlPanelResources.xml" ResourceName="System_Applications_Yuanlin_BusinessInfo_VisitGreenNumConfirm" />
            <nwap:ValuedTextBox Runat="server" CssClass="InputField MiddleWidth" id="visitGreenNumConfirmValuedTextBox" />
        </div>

        <div class="FormRow SubmitButtonRow">
            <nwap:Resourcebutton id="SaveButton" ResourceName="Save" CssClass="Button" Runat="server" OnClientClick="return checkvalue();"></nwap:Resourcebutton>&nbsp;&nbsp;&nbsp;&nbsp;
            <nwap:Resourcebutton id="BackButton" ResourceName="Back" CssClass="Button" Runat="server"></nwap:Resourcebutton>
        </div>	
    </fieldset>
</div> 